(() => {

    'use strict';
    goog.provide('Blockly.Arduino.ruilong');
    goog.require('Blockly.Arduino');

    goog.require('path');

    const mediaDirPath = path.join(document.currentScript.src, '../../media/');

    Blockly.Msg['RUILONG_HUE'] = 120;

    //语音模块(68段日常用语)
    var VOICE_PIN = [["老师", "0x00"], ["爸爸", "0x01"], ["妈妈", "0x02"], ["爷爷", "0x03"],
    ["奶奶", "0x04"], ["姥姥", "0x05"], ["姥爷", "0x06"], ["哥哥", "0x07"],
    ["姐姐", "0x08"], ["叔叔", "0x09"], ["阿姨", "0x0A"], ["上午", "0x0B"],
    ["下午", "0x0C"], ["晚上", "0x0D"], ["前方", "0x0E"], ["厘米", "0x0F"],
    ["新年快乐", "0x10"], ["身体健康", "0x11"], ["工作顺利", "0x12"], ["学习进步", "0x13"],
    ["您好", "0x14"], ["谢谢", "0x15"], ["的", "0x16"], ["祝", "0x17"],
    ["慢走", "0x18"], ["欢迎光临", "0x19"], ["亲爱的", "0x1A"], ["同学们", "0x1B"],
    ["工作辛苦了", "0x1C"], ["点", "0x1D"], ["打开", "0x1E"], ["关闭", "0x1F"],
    ["千", "0x20"], ["百", "0x21"], ["十", "0x22"], ["1", "0x23"],
    ["2", "0x24"], ["3", "0x25"], ["4", "0x26"], ["5", "0x27"],
    ["6", "0x28"], ["7", "0x29"], ["8", "0x2A"], ["9", "0x2B"],
    ["0", "0x2C"], ["当前", "0x2D"], ["转", "0x2E"], ["左", "0x2F"],
    ["右", "0x30"], ["请", "0x31"], ["已", "0x32"], ["现在", "0x33"],
    ["是", "0x34"], ["红灯", "0x35"], ["绿灯", "0x36"], ["黄灯", "0x37"],
    ["温度", "0x38"], ["湿度", "0x39"], ["欢迎常来", "0x3A"], ["还有", "0x3B"],
    ["秒", "0x3C"], ["分", "0x3D"], ["变", "0x3E"], ["等", "0x3F"],
    ["下一次", "0x40"], ["功能", "0x41"], ["障碍物", "0x42"], ["世界那么大，我想去看看", "0x43"]];

    //语音模块(68段日常用语)  播放语音段
    Blockly.Blocks.ruilong_pins_voice = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("")
                .appendField(new Blockly.FieldDropdown(VOICE_PIN), 'VOICE');
            this.setOutput(true, Number);
        }
    };
    //语音模块(68段日常用语)  组合播放数值
    Blockly.Blocks.ruilong_voice = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("语音模块(68段日常用语)").appendField(new Blockly.FieldImage(mediaDirPath + "/ruilong/RLSEB068NV.png", 40, 63));;
            this.appendValueInput("PIN", Number).appendField(Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("VOICE").appendField("播放").setCheck(Number);
            this.appendValueInput("WAIT").setCheck(Number).appendField("等待（ms）");
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setInputsInline(true);
        }
    };

    Blockly.Blocks.ruilong_voice_NUM = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("语音模块(68段日常用语)");
            this.appendValueInput("PIN", Number).appendField(Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("NUM").appendField("播放数值").setCheck(Number);
            this.appendValueInput("WAIT").setCheck(Number).appendField("等待（ms）");
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setInputsInline(true);
        }
    };
    //GD5800 MP3模块
    var ruilong_GD5800_MP3_CONTROL_TYPE = [
        ["播放", "play();"],
        ["暂停", "pause();"],
        ["下一曲", "next();"],
        ["上一曲", "prev();"],
        ["音量加", "volumeUp();"],
        ["音量减", "volumeDn();"]
    ];

    //GD5800 MP3模块
    Blockly.Blocks.ruilong_GD5800_UART_MP3_CONTROL = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("GD5800 串口MP3模块").appendField(new Blockly.FieldImage(mediaDirPath + "/ruilong/RLSEB580GD.png", 63, 63));
            this.appendValueInput("RXPIN", Number).appendField("接收(R)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("TXPIN", Number).appendField("发送(T)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendDummyInput("").appendField(Blockly.Msg.MIXLY_STAT).appendField(new Blockly.FieldDropdown(ruilong_GD5800_MP3_CONTROL_TYPE), "CONTROL_TYPE");
            this.setInputsInline(true);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip();
            this.setHelpUrl();
        }
    };

    //MP3循环模式
    var ruilong_GD5800_MP3_LOOP_MODE = [
        [Blockly.Msg.MIXLY_MP3_LOOP_ALL, "MP3_LOOP_ALL"],
        [Blockly.Msg.MIXLY_MP3_LOOP_FOLDER, "MP3_LOOP_FOLDER"],
        [Blockly.Msg.MIXLY_MP3_LOOP_ONE, "MP3_LOOP_ONE"],
        [Blockly.Msg.MIXLY_MP3_LOOP_RAM, "MP3_LOOP_RAM"]
    ];

    //GD5800 MP3模块循环模式
    Blockly.Blocks.ruilong_GD5800_MP3_LOOP_MODE = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("GD5800 串口MP3模块");
            this.appendValueInput("RXPIN", Number).appendField("接收(R)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("TXPIN", Number).appendField("发送(T)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendDummyInput("").appendField(Blockly.Msg.MIXLY_MP3_LOOP_MODE).appendField(Blockly.Msg.MIXLY_STAT).appendField(new Blockly.FieldDropdown(ruilong_GD5800_MP3_LOOP_MODE), "LOOP_MODE");
            this.setInputsInline(true);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip();
            this.setHelpUrl();
        }
    };

    //MP3 设置EQ
    var ruilong_GD5800_MP3_EQ_MODE = [
        [Blockly.Msg.MIXLY_MP3_EQ_NORMAL, "MP3_EQ_NORMAL"],
        [Blockly.Msg.MIXLY_MP3_EQ_POP, "MP3_EQ_POP"],
        [Blockly.Msg.MIXLY_MP3_EQ_ROCK, "MP3_EQ_ROCK"],
        [Blockly.Msg.MIXLY_MP3_EQ_JAZZ, "MP3_EQ_JAZZ"],
        [Blockly.Msg.MIXLY_MP3_EQ_CLASSIC, "MP3_EQ_CLASSIC"],
        [Blockly.Msg.MIXLY_MP3_EQ_BASS, "MP3_EQ_BASS"]
    ];

    //GD5800 MP3模块EQ模式
    Blockly.Blocks.ruilong_GD5800_MP3_EQ_MODE = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("GD5800 串口MP3模块");
            this.appendValueInput("RXPIN", Number).appendField("接收(R)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("TXPIN", Number).appendField("发送(T)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendDummyInput("").appendField(Blockly.Msg.MIXLY_MP3_EQ_MODE).appendField(Blockly.Msg.MIXLY_STAT).appendField(new Blockly.FieldDropdown(ruilong_GD5800_MP3_EQ_MODE), "EQ_MODE");
            this.setInputsInline(true);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip();
            this.setHelpUrl();
        }
    };

    //GD5800 MP3模块设置音量
    Blockly.Blocks.ruilong_GD5800_MP3_VOL = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("GD5800 串口MP3模块");
            this.appendValueInput("RXPIN", Number).appendField("接收(R)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("TXPIN", Number).appendField("发送(T)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendDummyInput("").appendField(Blockly.Msg.MIXLY_MP3_VOL);
            this.appendValueInput("vol", Number).appendField(Blockly.Msg.MIXLY_STAT).setCheck(Number);
            this.setInputsInline(true);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip();
            this.setHelpUrl();
        }
    };

    //GD5800 MP3模块播放第N首
    Blockly.Blocks.ruilong_GD5800_MP3_PLAY_NUM = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("GD5800 串口MP3模块");
            this.appendValueInput("RXPIN", Number).appendField("接收(R)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("TXPIN", Number).appendField("发送(T)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("NUM", Number).appendField(Blockly.Msg.MIXLY_MP3_PLAY_NUM).setCheck(Number);
            this.appendDummyInput("").appendField("首");
            this.setInputsInline(true);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip();
            this.setHelpUrl();
        }
    };

    //YX5300 MP3模块
    var ruilong_YX5300_MP3_CONTROL_TYPE = [
        ["播放", "play();"],
        ["暂停", "pause();"],
        ["停止", "stop();"],
        ["下一曲", "playNext();"],
        ["上一曲", "playPrevious();"],
        ["音量加", "volUp();"],
        ["音量减", "volDown();"]
    ];

    //YX5300 MP3模块
    Blockly.Blocks.ruilong_YX5300_UART_MP3_CONTROL = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("YX5300 串口MP3模块").appendField(new Blockly.FieldImage(mediaDirPath + "/ruilong/RLSEB530YX.png", 40, 63));
            this.appendValueInput("RXPIN", Number).appendField("接收(R)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("TXPIN", Number).appendField("发送(T)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendDummyInput("").appendField(Blockly.Msg.MIXLY_STAT).appendField(new Blockly.FieldDropdown(ruilong_YX5300_MP3_CONTROL_TYPE), "CONTROL_TYPE");
            this.setInputsInline(true);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip();
            this.setHelpUrl();
        }
    };
    //YX5300 MP3模块设置音量
    Blockly.Blocks.ruilong_YX5300_MP3_VOL = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("YX5300 串口MP3模块");
            this.appendValueInput("RXPIN", Number).appendField("接收(R)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("TXPIN", Number).appendField("发送(T)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendDummyInput("").appendField(Blockly.Msg.MIXLY_MP3_VOL);
            this.appendValueInput("vol", Number).appendField(Blockly.Msg.MIXLY_STAT).setCheck(Number);
            this.setInputsInline(true);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip();
            this.setHelpUrl();
        }
    };

    //YX5300 MP3模块播放第N首
    Blockly.Blocks.ruilong_YX5300_MP3_PLAY_NUM = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("YX5300 串口MP3模块");
            this.appendValueInput("RXPIN", Number).appendField("接收(R)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("TXPIN", Number).appendField("发送(T)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("NUM", Number).appendField(Blockly.Msg.MIXLY_MP3_PLAY_NUM).setCheck(Number);
            this.appendDummyInput("").appendField("首");
            this.setInputsInline(true);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip();
            this.setHelpUrl();
        }
    };
    //YX5300 MP3模块循环播放第N首
    Blockly.Blocks.ruilong_YX5300_MP3_PLAYSL = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("YX5300 串口MP3模块");
            this.appendValueInput("RXPIN", Number).appendField("接收(R)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("TXPIN", Number).appendField("发送(T)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("NUM", Number).appendField("循环播放第").setCheck(Number);
            this.appendDummyInput("").appendField("首");
            this.setInputsInline(true);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip();
            this.setHelpUrl();
        }
    };
    //YX5300 MP3模块循环播放在F文件夹 第N首
    Blockly.Blocks.ruilong_YX5300_MP3_PLAYFSL = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("YX5300 串口MP3模块");
            this.appendValueInput("RXPIN", Number).appendField("接收(R)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("TXPIN", Number).appendField("发送(T)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("FOLDER", Number).appendField("循环播放文件夹").setCheck(Number);
            this.appendDummyInput("");
            this.appendValueInput("NUM", Number).appendField("第").setCheck(Number);
            this.appendDummyInput("").appendField("首");
            this.setInputsInline(true);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip();
            this.setHelpUrl();
        }
    };
    //YX5300 MP3模块循环播放文件夹
    Blockly.Blocks.ruilong_YX5300_MP3_PLAYF = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("YX5300 串口MP3模块");
            this.appendValueInput("RXPIN", Number).appendField("接收(R)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("TXPIN", Number).appendField("发送(T)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("FOLDER", Number).appendField("循环播放文件夹").setCheck(Number);
            this.appendDummyInput("");
            this.setInputsInline(true);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip();
            this.setHelpUrl();
        }
    };
    //N910X MP3模块 控制
    var M9101X_S_MP3_CONTROL_TYPE = [
        ["播放", "play();"],
        ["暂停", "pause();"],
        ["停止", "stop();"],
        ["下一曲", "play_down();"],
        ["上一曲", "play_up();"],
        ["全部循环", "cycle_all();"],
        ["单曲循环", "cycle_single();"],
        ["切换到TF卡", "set_sd();"],
        ["切换到U盘", "set_usb_flash();"],
        ["切换到MP3模式", "set_mp3();"],
        ["切换到flash模式", "set_flash();"],
        ["切换音乐风格", "set_eq();"],
    ];

    Blockly.Blocks.ruilong_M9101X_S_MP3_CONTROL = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("")
                .appendField("M9101X 单线控制 MP3模块")
                .appendField(new Blockly.FieldImage(mediaDirPath + "/ruilong/RLSEB911NX.png", 63, 63));
            this.appendValueInput("PIN", Number)
                .appendField(Blockly.Msg.MIXLY_PIN)
                .setCheck(Number);
            this.appendDummyInput("").appendField(Blockly.Msg.MIXLY_STAT).appendField(new Blockly.FieldDropdown(M9101X_S_MP3_CONTROL_TYPE), "CONTROL_TYPE");
            this.setInputsInline(true);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip();
            this.setHelpUrl();
        }
    };
    //N910X MP3模块 音量设置
    Blockly.Blocks.ruilong_M9101X_S_MP3_VOL_CONTROL = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("M9101X 单线控制 MP3模块");
            this.appendValueInput("PIN", Number).appendField(Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendDummyInput("").appendField(Blockly.Msg.MIXLY_MP3_VOL);
            this.appendValueInput("NUM", Number).appendField(Blockly.Msg.MIXLY_STAT).setCheck(Number);
            this.setInputsInline(true);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip();
            this.setHelpUrl();
        }
    };

    //N910X MP3模块播放第N首
    Blockly.Blocks.ruilong_M9101X_S_MP3_PLAY_NUM = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("M9101X 单线控制 MP3模块");
            this.appendValueInput("PIN", Number).appendField(Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("NUM", Number).appendField(Blockly.Msg.MIXLY_MP3_PLAY_NUM).setCheck(Number);
            this.appendDummyInput("").appendField("首");
            this.setInputsInline(true);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip();
            this.setHelpUrl();
        }
    };

    Blockly.Blocks.ruilong_SYN6288_VOICE_TEXT = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("机器人语音模块").appendField(new Blockly.FieldImage(mediaDirPath + "/ruilong/RLSEB628SY.png", 63, 63));
            this.appendValueInput("RXPIN", Number).appendField("接收(R)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("TXPIN", Number).appendField("发送(T)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("NUM", Number).appendField("语音编号").setCheck(Number);
            this.appendValueInput("TEXT", String).setCheck([Number, String]).setAlign(Blockly.ALIGN_RIGHT).appendField(" 内容为");
            this.setInputsInline(true);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip();
            this.setHelpUrl();
        }
    };

    Blockly.Blocks.ruilong_SYN6288_VOICE_NUM = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("机器人语音模块");
            this.appendValueInput("RXPIN", Number).appendField("接收(R)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("TXPIN", Number).appendField("发送(T)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("NUM", Number).appendField("变量编号").setCheck(Number);
            this.appendValueInput("VALUE", String).setCheck([Number, String]).setAlign(Blockly.ALIGN_RIGHT).appendField("数值为");
            this.setInputsInline(true);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip("数值位数5位以内");
            this.setHelpUrl();
        }
    };

    var SYN6288_VOICE_VOL_LIST = [
        ["静音", "[v0]"], ["1", "[v1]"], ["2", "[v2]"], ["3", "[v3]"],
        ["4", "[v4]"], ["5", "[v5]"], ["6", "[v6]"], ["7", "[v7]"],
        ["8", "[v8]"], ["9", "[v9]"], ["10", "[v10]"], ["11", "[v12]"],
        ["13", "[v13]"], ["14", "[v14]"], ["15", "[v15]"], ["16", "[v16]"]
    ];

    var SYN6288_VOICE_BKVOL_LIST = [
        ["静音", "[m0]"], ["1", "[m1];"], ["2", "[m2]"], ["3", "[m3];"],
        ["4", "[m4]"], ["5", "[m5];"], ["6", "[m6]"], ["7", "[m7];"],
        ["8", "[m8]"], ["9", "[m9];"], ["10", "[m10]"], ["11", "[m12];"],
        ["13", "[m13]"], ["14", "[m14];"], ["15", "[m15]"], ["16", "[m16];"]
    ];

    var SYN6288_VOICE_SPEED_LIST = [
        ["0", "[t0]"], ["1", "[t1];"], ["2", "[t2]"], ["3", "[t3];"],
        ["4", "[t4]"], ["5", "[t5];"]
    ];

    Blockly.Blocks.ruilong_SYN6288_VOICE_VOL = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("机器人语音模块");
            this.appendValueInput("RXPIN", Number).appendField("接收(R)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("TXPIN", Number).appendField("发送(T)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendDummyInput("").appendField("文本播放音量").appendField(Blockly.Msg.MIXLY_STAT).appendField(new Blockly.FieldDropdown(SYN6288_VOICE_VOL_LIST), "CONTROL_TYPE");
            this.setInputsInline(true);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip();
            this.setHelpUrl();
        }
    };

    Blockly.Blocks.ruilong_SYN6288_VOICE_BKVOL = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("机器人语音模块");
            this.appendValueInput("RXPIN", Number).appendField("接收(R)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("TXPIN", Number).appendField("发送(T)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendDummyInput("").appendField("背景音乐音量").appendField(Blockly.Msg.MIXLY_STAT).appendField(new Blockly.FieldDropdown(SYN6288_VOICE_BKVOL_LIST), "CONTROL_TYPE");
            this.setInputsInline(true);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip();
            this.setHelpUrl();
        }
    };

    Blockly.Blocks.ruilong_SYN6288_VOICE_SPEED = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("机器人语音模块");
            this.appendValueInput("RXPIN", Number).appendField("接收(R)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("TXPIN", Number).appendField("发送(T)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendDummyInput("").appendField("语音速度").appendField(Blockly.Msg.MIXLY_STAT).appendField(new Blockly.FieldDropdown(SYN6288_VOICE_SPEED_LIST), "CONTROL_TYPE");
            this.setInputsInline(true);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip();
            this.setHelpUrl();
        }
    };

    var SYN6288_VOICE_CONTROL_TYPE = [
        ["停止", "Stop();"],
        ["暂停", "Pause();"],
        ["恢复", "Recover();"],
        ["休眠", "EnterSleep();"],
        ["唤醒", "ExitSleep();"],
    ];

    //SYN6288 语音模块
    Blockly.Blocks.ruilong_SYN6288_VOICE_CONTROL = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("机器人语音模块");
            this.appendValueInput("RXPIN", Number).appendField("接收(R)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("TXPIN", Number).appendField("发送(T)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendDummyInput("").appendField(Blockly.Msg.MIXLY_STAT).appendField(new Blockly.FieldDropdown(SYN6288_VOICE_CONTROL_TYPE), "CONTROL_TYPE");
            this.setInputsInline(true);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip();
            this.setHelpUrl();
        }
    };


Blockly.Blocks.ruilong_SNR9816TTS_SET = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("语音合成模块").appendField(new Blockly.FieldImage(mediaDirPath + "/ruilong/RLSEB462SR.png", 63, 63));;
            this.appendValueInput("RXPIN", Number).appendField("接收(R)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("TXPIN", Number).appendField("发送(T)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendDummyInput("")
                .appendField("音量").appendField(new Blockly.FieldDropdown([["V0","0"],["V1","1"],["V2","2"],["V3","3"],["V4","4"],
                                                        ["V5","5"],["V6","6"],["V7","7"],["V8","8"],["V9","9"]]), "VOL");
            this.appendDummyInput("")
                .appendField("语速").appendField(new Blockly.FieldDropdown([["S0","0"],["S1","1"],["S2","2"],["S3","3"],["S4","4"],
                                                        ["S5","5"],["S6","6"],["S7","7"],["S8","8"],["S9","9"]]), "SPEED");
            this.appendDummyInput("")
                .appendField("语调").appendField(new Blockly.FieldDropdown([["T0","0"],["T1","1"],["T2","2"],["T3","3"],["T4","4"],
                                                        ["T5","5"],["T6","6"],["T7","7"],["T8","8"],["T9","9"]]), "TONE");
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setInputsInline(true);

        }
    };
        
    
    Blockly.Blocks.ruilong_SNR9816TTS_TEXT = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("语音合成模块 播放");
            this.appendValueInput("RXPIN", Number).appendField("接收(R)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("TXPIN", Number).appendField("发送(T)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("TEXT", String).setCheck([Number, String]);
            this.setInputsInline(true);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip();
            this.setHelpUrl();
        }
    };

       Blockly.Blocks.ruilong_SNR9816TTS_CONTROL = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("语音合成模块");
            this.appendValueInput("RXPIN", Number).appendField("接收(R)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("TXPIN", Number).appendField("发送(T)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendDummyInput("")
                .appendField("音量").appendField(new Blockly.FieldDropdown([["暂停","pause"],["继续","continues"],["停止","stop"]]), "CON");
            
            

            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setInputsInline(true);
        }
    };

       Blockly.Blocks.ruilong_SNR9816TTS_AUDIO = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("语音合成模块");
            this.appendValueInput("RXPIN", Number).appendField("接收(R)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendValueInput("TXPIN", Number).appendField("发送(T)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendDummyInput("")
                .appendField("内置音效").appendField(new Blockly.FieldDropdown([["铃声1","ring_1"],["铃声2","ring_2"],["铃声3","ring_3"],["铃声4","ring_4"],["铃声5","ring_5"],
                                                                            ["信息提示音1","message_1"],["信息提示音2","message_2"],["信息提示音3","message_3"],["信息提示音4","message_4"],["信息提示音5","message_5"],
                                                                            ["警示音1","alert_1"],["警示音2","alert_2"],["警示音3","alert_3"],["警示音4","alert_4"],["警示音5","alert_5"]]), "AUDIO");
            
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setInputsInline(true);
        }
    };

Blockly.Blocks.ruilong_03T_GET = {
         init: function() {
             this.setColour(Blockly.Msg['RUILONG_HUE']);
             this.appendDummyInput("").appendField("语音识别传感器");
             this.appendValueInput("RXPIN", Number).appendField("接收(R)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
             this.appendValueInput("TXPIN", Number).appendField("发送(T)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
             this.appendDummyInput("").appendField("检测到");
             this.appendDummyInput("").appendField(new Blockly.FieldDropdown([["智能管家","0X00"],
                                                                             ["打开台灯|请开灯|开灯|打开灯|我回来了","0X01"],
                                                                             ["关闭台灯|请关灯|关灯|睡觉了|关上灯|我出去了","0X02"],
                                                                             ["调亮一点|亮一点","0X03"],
                                                                             ["调暗一点|暗一点","0X04"],
                                                                             ["打开窗帘","0X11"],
                                                                             ["关闭窗帘","0X12"],
                                                                             ["打开空调","0X21"],
                                                                             ["关闭空调","0X22"],
                                                                             ["调高温度","0X23"],
                                                                             ["调低温度","0X24"],
                                                                             ["睡眠模式","0X25"],
                                                                             ["二十六度","0X26"],
                                                                             ["打开风扇","0X31"],
                                                                             ["关闭风扇","0X32"],
                                                                             ["风速一档","0X33"],
                                                                             ["风速二档","0X34"],
                                                                             ["风速三档","0X35"],
                                                                             ["播放音乐","0X41"],
                                                                             ["暂停播放","0X42"],
                                                                             ["停止播放","0X43"],
                                                                             ["上一曲","0X44"],
                                                                             ["下一曲","0X45"],
                                                                             ["调响一点|响一点|增大音量","0X46"],
                                                                             ["调轻一点|轻一点|减小音量","0X47"],
                                                                             ["前进","0X51"],
                                                                             ["后退","0X52"],
                                                                             ["左转","0X53"],
                                                                             ["右转","0X54"],
                                                                             ["停止","0X55"],
                                                                             ["快点|加速","0X56"],
                                                                             ["慢点|减速","0X57"],
                                                                             ["正转|顺时针","0X58"],
                                                                             ["反转|逆时针","0X59"],
                                                                             ["开机","0X5A"],
                                                                             ["关机","0X5B"]]), "VAL");
             this.setOutput(true, Boolean);
             this.setInputsInline(true);
             this.setTooltip('');
  }
};

    Blockly.Blocks.ruilong_03T_NUM = {
         init: function() {
             this.setColour(Blockly.Msg['RUILONG_HUE']);
             this.appendDummyInput("").appendField("语音识别模块");
              this.appendValueInput("RXPIN", Number).appendField("接收(R)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
             this.appendValueInput("TXPIN", Number).appendField("发送(T)" + Blockly.Msg.MIXLY_PIN).setCheck(Number);
             this.appendDummyInput("").appendField("识别词条序号");
             this.setOutput(true, Boolean);
             this.setInputsInline(true);
             this.setTooltip('');
  }
};

    var VS1053_GM1 = [["大钢琴", "VS1053_GM1_ACOUSTIC_GRAND_PIANO"], //钢琴
    ["亮音钢琴", "VS1053_GM1_Bright_Acoustic_Piano"],
    ["大电钢琴", "VS1053_GM1_ELECTRIC_GRAND_PIANO"],
    ["酒吧钢琴", "VS1053_GM1_Honky_tonk_Piano"],
    ["电钢琴1", "VS1053_GM1_Electric_Piano_1"],
    ["电钢琴2", "VS1053_GM1_Electric_Piano_2"],
    ["大键琴", "VS1053_GM1_Harpsichord"],
    ["电翼琴", "VS1053_GM1_Clavichord"],
    ["钢片琴", "VS1053_GM1_Celesta"],//打击乐器
    ["钟琴", "VS1053_GM1_Glockenspiel"],
    ["八音盒", "VS1053_GM1_Music_box"],
    ["颤音琴", "VS1053_GM1_Vibraphone"],
    ["马林巴", "VS1053_GM1_Marimba"],
    ["木琴", "VS1053_GM1_Xylophone"],
    ["管钟", "VS1053_GM1_Tubular_Bells"],
    ["扬琴", "VS1053_GM1_Dulcimer"],
    ["音栓风琴", "VS1053_GM1_Drawbar_Organ"],//风琴
    ["敲击风琴", "VS1053_GM1_Percussive_Organ"],
    ["摇滚风琴", "VS1053_GM1_Rock_Organ"],
    ["教堂风琴", "VS1053_GM1_Church_Organ"],
    ["簧管风琴", "VS1053_GM1_Reed_Organ"],
    ["手风琴", "VS1053_GM1_Accordian"],
    ["口琴 ", "VS1053_GM1_Harmonica"],
    ["探戈手风琴", "VS1053_GM1_Tango_Accordian"],
    ["木吉他（尼龙弦）", "VS1053_GM1_Acoustic_Guitar1"],//吉他
    ["木吉他（钢弦）", "VS1053_GM1_Acoustic_Guitar2"],
    ["电吉他（爵士）", "VS1053_GM1_Electric_Guitar1"],
    ["电吉他（清音）", "VS1053_GM1_Electric_Guitar2"],
    ["电吉他（闷音）", "VS1053_GM1_Electric_Guitar3"],
    ["电吉他（驱动音效）", "VS1053_GM1_Overdriven_Guitar"],
    ["电吉他（失真音效）", "VS1053_GM1_Distortion_Guitar"],
    ["吉他泛音", "VS1053_GM1_Guitar_Harmonics"],
    ["贝斯", "VS1053_GM1_Acoustic_Bass"],//贝司
    ["电贝斯（指奏）", "VS1053_GM1_Electric_Bass_finger"],
    ["电贝斯（拨奏）", "VS1053_GM1_Electric_Bass_pick"],
    ["无品贝斯", "VS1053_GM1_Fretless_Bass"],
    ["捶鈎贝斯1", "VS1053_GM1_Slap_Bass1"],
    ["捶鈎贝斯2", "VS1053_GM1_Slap_Bass2"],
    ["合成贝斯1", "VS1053_GM1_Synth_Bass1"],
    ["合成贝斯2", "VS1053_GM1_Synth_Bass2"],
    ["小提琴", "VS1053_GM1_Violin"],//弦乐
    ["中提琴", "VS1053_GM1_Viola"],
    ["大提琴", "VS1053_GM1_Cello"],
    ["低音大提琴", "VS1053_GM1_Contrabass"],
    ["颤弓弦乐", "VS1053_GM1_Tremolo_Strings"],
    ["弹拨弦乐", "VS1053_GM1_Pizzicato_Strings"],
    ["竖琴", "VS1053_GM1_Orchestral_Harp"],
    ["定音鼓", "VS1053_GM1_Timpani"],
    ["弦乐合奏1", "VS1053_GM1_String_Ensemble1"],//合奏
    ["弦乐合奏2", "VS1053_GM1_String_Ensemble2"],
    ["合成弦乐合奏1", "VS1053_GM1_Synth_Strings1"],
    ["合成弦乐合奏2", "VS1053_GM1_Synth_Strings2"],
    ["人声“啊”", "VS1053_GM1_Choir_Aahs"],
    ["人声“喔”", "VS1053_GM1_Voice_Oohs"],
    ["合成人声", "VS1053_GM1_Synth_Voice"],
    ["交响打击乐", "VS1053_GM1_Orchestra_Hit"],
    ["小号", "VS1053_GM1_Trumpet"],//铜管乐器
    ["长号", "VS1053_GM1_Trombone"],
    ["大号", "VS1053_GM1_Tuba"],
    ["闷音小号", "VS1053_GM1_Muted_Trumpet"],
    ["法国号（圆号）", "VS1053_GM1_French_Horn"],
    ["铜管乐", "VS1053_GM1_Brass_Section"],
    ["合成铜管1", "VS1053_GM1_Synth_Brass1"],
    ["合成铜管2", "VS1053_GM1_ynth_Brass2"],
    ["高音萨克斯风", "VS1053_GM1_Soprano_Sax"],//簧乐器
    ["次中音萨克斯风", "VS1053_GM1_Alto_Sax"],
    ["中音萨克斯风", "VS1053_GM1_Tenor_Sax"],
    ["低音萨克斯风", "VS1053_GM1_Baritone_Sax"],
    ["双簧管", "VS1053_GM1_Oboe"],
    ["英国管", "VS1053_GM1_English_Horn"],
    ["巴松（大管）", "VS1053_GM1_Bassoon"],
    ["单簧管（黑管）", "VS1053_GM1_Clarinet"],
    ["短笛", "VS1053_GM1_Piccolo"],//笛 
    ["长笛", "VS1053_GM1_Flute"],
    ["竖笛", "VS1053_GM1_Recorder"],
    ["排笛", "VS1053_GM1_Pan_Flute"],
    ["瓶笛", "VS1053_GM1_Bottle_Blow"],
    ["尺八", "VS1053_GM1_Shakuhachi"],
    ["哨子", "VS1053_GM1_Whistle"],
    ["陶笛", "VS1053_GM1_Ocarina"],
    ["方波", "VS1053_GM1_Lead1"],//合成主音 
    ["锯齿波", "VS1053_GM1_Lead2"],
    ["汽笛风琴", "VS1053_GM1_Lead3"],
    ["合成吹管", "VS1053_GM1_Lead4"],
    ["合成电吉他", "VS1053_GM1_Lead5"],
    ["人声键盘", "VS1053_GM1_Lead6"],
    ["五度音", "VS1053_GM1_Lead7"],
    ["贝斯吉他合奏", "VS1053_GM1_Lead8"],
    ["新世纪", "VS1053_GM1_Pad1"],//合成音色
    ["温暖", "VS1053_GM1_Pad2"],
    ["多重合音", "VS1053_GM1_Pad3"],
    ["人声合唱", "VS1053_GM1_Pad4"],
    ["玻璃", "VS1053_GM1_Pad5"],
    ["金属", "VS1053_GM1_Pad6"],
    ["光华", "VS1053_GM1_Pad7"],
    ["扫掠", "VS1053_GM1_Pad8"],
    ["雨", "VS1053_GM1_FX1"],//合成效果 
    ["电影音效", "VS1053_GM1_FX2"],
    ["水晶", "VS1053_GM1_FX3"],
    ["气氛", "VS1053_GM1_FX4"],
    ["明亮", "VS1053_GM1_FX5"],
    ["魅影", "VS1053_GM1_FX6"],
    ["回音", "VS1053_GM1_FX7"],
    ["科幻", "VS1053_GM1_FX8"],
    ["西塔琴", "VS1053_GM1_Sitar"],//民间乐器
    ["五弦琴（斑鸠琴）", "VS1053_GM1_Banjo"],
    ["三味线", "VS1053_GM1_Shamisen"],
    ["十三弦琴（古筝）", "VS1053_GM1_Koto"],
    ["卡林巴铁片琴", "VS1053_GM1_Kalimba"],
    ["苏格兰风笛", "VS1053_GM1_Bagpipe"],
    ["古提琴", "VS1053_GM1_Fiddle"],
    ["兽笛", "VS1053_GM1_Shanai"],
    ["叮当铃", "VS1053_GM1_Tinkle_Bell"],//打击乐器
    ["阿哥哥鼓", "VS1053_GM1_Agogo"],
    ["钢鼓", "VS1053_GM1_Steel_Drums"],
    ["木鱼", "VS1053_GM1_Woodblock"],
    ["太鼓", "VS1053_GM1_Taiko_Drum"],
    ["定音筒鼓", "VS1053_GM1_Melodic_Tom"],
    ["合成鼓", "VS1053_GM1_Synth_Drum"],
    ["逆转钹声", "VS1053_GM1_Reverse_Cymbal"],
    ["吉他滑弦杂音", "VS1053_GM1_Guitar_Fret_Noise"],//Sound Effects 特殊 音效
    ["呼吸杂音", "VS1053_GM1_122_Breath_Noise"],
    ["海岸", "VS1053_GM1_Seashore"],
    ["鸟鸣", "VS1053_GM1_Bird_Tweet"],
    ["电话铃声", "VS1053_GM1_Telephone_Ring"],
    ["直升机", "VS1053_GM1_Helicopter"],
    ["拍手", "VS1053_GM1_Applause"],
    ["枪声", "VS1053_GM1_Gunshot"]
    ];

    var VS1053_GM1_GM2 = [["电子乐中的按钮声", "VS1053_GM1_GM2_High_Q"],
    ["拍打声", "VS1053_GM1_GM2_Slap"],
    ["特效处理推音", "VS1053_GM1_GM2_Scratch_Push"],
    ["特效处理拉（勾）音", "VS1053_GM1_GM2_Scratch_Pull"],
    ["鼓棒敲击声", "VS1053_GM1_GM2_Sticks"],
    ["敲方板", "VS1053_GM1_GM2_SquareClick"],
    ["Click-节拍器击打", "VS1053_GM1_GM2_Metronome"],
    ["节拍器铃声", "VS1053_GM1_GM2_Metronome_Bell"],
    ["原声大鼓（低音大鼓）", "VS1053_GM1_GM2_Acoustic_Bass_Drum"],
    ["大鼓1（低音鼓）", "VS1053_GM1_GM2_Bass_Drum_1"],
    ["敲鼓边", "VS1053_GM1_GM2_Side_Stick"],
    ["原声小鼓（军鼓、小鼓）", "VS1053_GM1_GM2_Acoustic_Snare"],
    ["拍手", "VS1053_GM1_GM2_Hand_Clap"],
    ["电子小鼓（电子军鼓）", "VS1053_GM1_GM2_Electric_Snare"],
    ["低音落地筒鼓", "VS1053_GM1_GM2_Low_Floor_Tom"],
    ["闭合踩镲（闭合双面镲）", "VS1053_GM1_GM2_Closed_Hi_Hat"],
    ["高音落地筒鼓", "VS1053_GM1_GM2_High_Floor_Tom"],
    ["踩镲（踩镲双面镲）", "VS1053_GM1_GM2_Pedal_Hi_Hat"],
    ["低音筒鼓", "VS1053_GM1_GM2_Low_Tom"],
    ["开放（双面）镲", "VS1053_GM1_GM2_Open_Hi_Hat"],
    ["中低音筒鼓", "VS1053_GM1_GM2_Low_Mid_Tom"],
    ["中高音筒鼓", "VS1053_GM1_GM2_Hi_Mid_Tom"],
    ["镲击（吊镲）1", "VS1053_GM1_GM2_Crash_Cymbal"],
    ["高音筒鼓", "VS1053_GM1_GM2_High_Tom"],
    ["高架镲1", "VS1053_GM1_GM2_Ride_Cymbal_1"],
    ["中国镲", "VS1053_GM1_GM2_Chinese_Cymbal"],
    ["悬挂钟玲", "VS1053_GM1_GM2_Ride_Bell"],
    ["铃鼓、小手鼓", "VS1053_GM1_GM2_Tambourine"],
    ["侧击镲、溅开镲声", "VS1053_GM1_GM2_Splash_Cymbal"],
    ["牛铃、颈铃", "VS1053_GM1_GM2_Cowbell"],
    ["镲击（吊镲）2", "VS1053_GM1_GM2_Crash_Cymbal"],
    ["颤击", "VS1053_GM1_GM2_Vibraslap"],
    ["高架镲2", "VS1053_GM1_GM2_Ride_Cymbal"],
    ["高音邦加鼓", "VS1053_GM1_GM2_High_Bongo"],
    ["低音邦加鼓", "VS1053_GM1_GM2_Low_Bongo"],
    ["闷音高音康加鼓", "VS1053_GM1_GM2_Mute_Hi_Conga"],
    ["开放音高音康加鼓", "VS1053_GM1_GM2_Open_Hi_Conga"],
    ["低音康加鼓", "VS1053_GM1_GM2_Low_Conga"],
    ["高音定音鼓", "VS1053_GM1_GM2_High_Timbale"],
    ["低音定音鼓", "VS1053_GM1_GM2_Low_Timbale"],
    ["高音撞铃（拉丁打铃）", "VS1053_GM1_GM2_High_Agogo"],
    ["低音撞铃（拉丁打铃）", "VS1053_GM1_GM2_Low_Agogo"],
    ["卡巴沙铃（珠铃）", "VS1053_GM1_GM2_Cabasa"],
    ["砂槌（砂铃）", "VS1053_GM1_GM2_Maracas"],
    ["短口哨", "VS1053_GM1_GM2_Short_Whistle"],
    ["长口哨", "VS1053_GM1_GM2_Long_Whistle"],
    ["短音刮板（短锯琴、短梗笛）", "VS1053_GM1_GM2_Short_Guiro"],
    ["长音刮板（长梗笛）", "VS1053_GM1_GM2_Long_Guiro"],
    ["音棒", "VS1053_GM1_GM2_Claves"],
    ["高音木鱼", "VS1053_GM1_GM2_Hi_Wood_Block"],
    ["低音木鱼", "VS1053_GM1_GM2_Low_Wood_Block"],
    ["闷音鸟鸣桶（短笛）", "VS1053_GM1_GM2_Mute_Cuica"],
    ["开音鸟鸣桶（短笛）", "VS1053_GM1_GM2_Open_Cuica"],
    ["闷音三角铁（三角铃）", "VS1053_GM1_GM2_Mute_Triangle"],
    ["开音三角铁", "VS1053_GM1_GM2_Open_Triangle"],
    ["摇筛（振动筛）", "VS1053_GM1_GM2_Shaker"],
    ["门铃（信号铃、铃铛）", "VS1053_GM1_GM2_Jingle_Bell"],
    ["铃树（树铃）", "VS1053_GM1_GM2_Bell_Tree"],
    ["响板", "VS1053_GM1_GM2_Castinets"],
    ["闷音苏多鼓", "VS1053_GM1_GM2_Mute_Surdo"],
    ["开音苏多鼓", "VS1053_GM1_GM2_Open_Surdo"]];


    Blockly.Blocks.ruilong_vs1053_midi_GM1 = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField(new Blockly.FieldDropdown(VS1053_GM1), "VS1053_GM1");
            this.setOutput(true, Number);
        }
    };


    Blockly.Blocks.ruilong_vs1053_midi_Instrument = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("设置Midi").appendField(new Blockly.FieldImage(mediaDirPath + "/ruilong/RLSEB153VS.png", 63, 63));
            this.appendValueInput("TXPIN", Number).appendField(Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendDummyInput("").appendField(new Blockly.FieldDropdown([["通道0", "0"], ["通道1", "1"], ["通道2", "2"], ["通道3", "3"],
            ["通道4", "4"], ["通道5", "5"], ["通道6", "6"], ["通道7", "7"],
            ["通道8", "8"], ["通道9", "9"], ["通道10", "10"], ["通道11", "11"],
            ["通道12", "12"], ["通道13", "13"], ["通道14", "14"], ["通道15", "15"]]), "CH");
            this.appendValueInput("INSTRUMENT", Number).appendField(new Blockly.FieldDropdown([["旋律乐器", "0x79"], ["打击乐器", "0x78"]]), "TYPE").setCheck(Number).setAlign(Blockly.ALIGN_RIGHT);
            this.appendDummyInput("").appendField("音量");
            this.appendValueInput("MIDIVolume", Number).setCheck(Number).setAlign(Blockly.ALIGN_RIGHT);
            this.setInputsInline(true);
            //var tip="音调/音量范围(0~127)\n";
            this.setPreviousStatement(true);
            this.setNextStatement(true);
            this.setTooltip(Blockly.Msg.MIXLY_VOLUMEChoose);
            //this.setOutput(true);
        }
    };



    Blockly.Blocks.ruilong_midiPitch = {
        init: function () {
            var highlist = [["1", "-36"], ["2", "-24"], ["3", "-12"], ["4", "0"], ["5", "12"], ["6", "24"], ["7", "36"]];
            var midipitch = [["C", "60"], ["C#", "61"], ["D", "62"], ["D#", "63"], ["E", "64"], ["F", "65"], ["F#", "66"], ["G", "67"], ["G#", "68"], ["A", "69"], ["A#", "70"], ["B", "71"]];
            //this.setHelpUrl(Blockly.Msg.MATH_ARITHMETIC_HELPURL);
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("音区").appendField(new Blockly.FieldDropdown(highlist), "highlist");
            this.appendDummyInput("").appendField("音高").appendField(new Blockly.FieldDropdown(midipitch), "midipitch");
            this.setInputsInline(true);
            this.setOutput(true, Number);
            this.setTooltip('');
        }
    };

    Blockly.Blocks.ruilong_vs1053_midi_GM1_GM2 = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("打击乐器").appendField(new Blockly.FieldDropdown(VS1053_GM1_GM2), "VS1053_GM1_GM2");
            this.setOutput(true, Number);

        }
    };

    Blockly.Blocks.ruilong_vs1053_midi_note = {
        init: function () {
            this.setColour(Blockly.Msg['RUILONG_HUE']);
            this.appendDummyInput("").appendField("设置Midi");
            this.appendValueInput("TXPIN", Number).appendField(Blockly.Msg.MIXLY_PIN).setCheck(Number);
            this.appendDummyInput("").appendField(new Blockly.FieldDropdown([["通道0", "0"], ["通道1", "1"], ["通道2", "2"], ["通道3", "3"],
            ["通道4", "4"], ["通道5", "5"], ["通道6", "6"], ["通道7", "7"],
            ["通道8", "8"], ["通道9", "9"], ["通道10", "10"], ["通道11", "11"],
            ["通道12", "12"], ["通道13", "13"], ["通道14", "14"], ["通道15", "15"]]), "CH");
            this.appendDummyInput("").appendField(new Blockly.FieldDropdown([["播放", "1"], ["停止", "0"]]), "NOTE_ON_OFF");
            this.appendValueInput("NOTE", Number).setCheck(Number).setAlign(Blockly.ALIGN_RIGHT);
            this.appendDummyInput("").appendField("力度");
            this.appendValueInput("VELOCITY", Number).setCheck(Number).setAlign(Blockly.ALIGN_RIGHT);
            this.setInputsInline(true);
            //var tip="音调/音量范围(0~127)\n";
            this.setPreviousStatement(true);
            this.setNextStatement(true);
            this.setTooltip(Blockly.Msg.MIXLY_VOLUMEChoose);
            //this.setOutput(true);
        }
    };

    var MOUSE_KEYBOARD_LIST = [
        ["A", "KEY_A"], ["B", "KEY_B"], ["C", "KEY_C"], ["D", "KEY_D"], ["E", "KEY_E"],
        ["F", "KEY_F"], ["G", "KEY_G"], ["H", "KEY_H"], ["I", "KEY_I"], ["J", "KEY_J"],
        ["K", "KEY_K"], ["L", "KEY_L"], ["M", "KEY_M"], ["N", "KEY_N"], ["O", "KEY_O"],
        ["P", "KEY_P"], ["Q", "KEY_Q"], ["R", "KEY_R"], ["S", "KEY_S"], ["T", "KEY_T"],
        ["U", "KEY_U"], ["V", "KEY_V"], ["W", "KEY_W"], ["X", "KEY_X"], ["Y", "KEY_Y"],
        ["Z", "KEY_Z"], ["1", "KEY_1"], ["2", "KEY_2"], ["3", "KEY_3"], ["4", "KEY_4"],
        ["5", "KEY_5"], ["6", "KEY_6"], ["7", "KEY_7"], ["8", "KEY_8"], ["9", "KEY_9"],
        ["0", "KEY_0"], ["↑", "KEY_UP_ARROW"], ["↓", "KEY_DOWN_ARROW"], ["←", "KEY_LEFT_ARROW"], ["→", "KEY_RIGHT_ARROW"],
        ["鼠标左键", "MOUSE_LEFT"], ["鼠标右键", "MOUSE_RIGHT"], ["鼠标中键", "MOUSE_MIDDLE"]];

})();